{include file="public/layout"/}
<body class="laytp-container">
<div class="layui-card">
    <div class="layui-card-body">
        <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-card layui-col-md12">
            <div class="layui-card-header">
                <div class="layui-card-header">
                    <div class="layui-tab layui-tab-brief">
                        <ul class="layui-tab-title">
                            {foreach $group_list as $group}
                            <li {if $inc_type==$group['inc_type']}class="layui-this"{/if} onclick="location.href='{$group['url']}'">{$group.name}</li>
                            {/foreach}
                        </ul>

                    </div>
                </div>
            </div>
            <div class="layui-card-body" pad15>
                <div class="layui-form" lay-filter="">
                    <div class="layui-tab layui-tab-brief" lay-filter="mytab">

                        <!--**************************基础设置******************************-->
                        <div class="layui-tab-content">

                            <!--登录注册-->
                            <div class="layui-tab-item layui-show">
                                {foreach $platform as $pl=>$pl_name}
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width:130px">{$pl_name}：</label>
                                        <div class="layui-input-inline" style="width:{if $pl=='h5'}400px{else}550px{/if}">
                                            <input type="checkbox" name="reg_{$pl}" title="注册登录" value="1"{if !empty($config['reg_'.$pl])}checked{/if}/>
                                            <input type="checkbox" name="mobile_login_{$pl}" title="手机号登录" value="1"{if !empty($config['mobile_login_'.$pl])}checked{/if}/>
                                            <if condition='$pl neq "h5"'>
                                                <input type="checkbox" name="auth_login_{$pl}" title="授权登录" value="1"{if !empty($config['auth_login_'.$pl])}checked{/if}/>
                                            </if>
                                        </div>
                                        <div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:160px;"></div>
                                    </div>
                                {/foreach}

                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width:130px">设置头像昵称：</label>
                                <div class="layui-input-inline" style="width:350px">
                                    <input type="radio" name="login_setnickname" title="不需要设置" value="0"{if $config['login_setnickname']==0}checked{/if} />
                                    <input type="radio" name="login_setnickname" title="可选设置" value="1" {if $config['login_setnickname']==1}checked{/if}/>
                                    <input type="radio" name="login_setnickname" title="强制设置" value="2" {if $config['login_setnickname']==2}checked{/if}/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">小程序端首次授权登录时是否提示设置头像昵称</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width:130px">绑定手机号：</label>
                                <div class="layui-input-inline" style="width:350px">
                                    <input type="radio" name="login_bind_mobile" title="不绑定" value="0" {if (isset($config['login_bind_mobile'])) && $config['login_bind_mobile']==0}checked{/if} />
                                    <input type="radio" name="login_bind_mobile" title="可选绑定" value="1" {if (isset($config['login_bind_mobile'])) && $config['login_bind_mobile']==1}checked{/if} />
                                    <input type="radio" name="login_bind_mobile" title="强制绑定" value="2" {if (isset($config['login_bind_mobile'])) && $config['login_bind_mobile']==2}checked{/if} />
                                </div>
                                <div class="layui-form-mid layui-word-aux">授权登录时是否提示绑定手机号</div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width:130px">强制登录：</label>
                                <div class="layui-input-inline" style="width:500px">
                                    {foreach $platform as $pl=>$pl_name}
                                        <input type="checkbox" name="login_mast_{$pl}" title="{$pl_name}" value="1" {if $config['login_mast_'.$pl]}checked{/if} lay-skin="primary"/>
                                    {/foreach}
                                </div>
                                <div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:160px;">
                                    开启后进入系统必须先登录
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" style="width:130px">注册审核：</label>
                                <div class="layui-input-inline" style="width:300px">
                                    <input type="radio" name="reg_check" title="关闭" value="0" {if $config['reg_check']==0}checked{/if} />
                                    <input type="radio" name="reg_check" title="开启" value="1" {if $config['reg_check']==1}checked{/if} />
                                </div>
                                <div class="layui-form-mid layui-word-aux"></div>
                            </div>
                        </div>

                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block" style="margin-left:175px;">
                        <button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
    </div>
</div>
<script>
    layui.use(function () {
        layui.laydate.render({
            elem: '#start_hours',
            type: 'time',
            format: 'HH:mm',
            trigger: 'click'
        });
        layui.laydate.render({
            elem: '#end_hours',
            type: 'time',
            format: 'HH:mm',
            trigger: 'click'
        });
        layui.laydate.render({
            elem: '#start_hours1',
            type: 'time',
            format: 'HH:mm',
            trigger: 'click'
        });
        layui.laydate.render({
            elem: '#end_hours1',
            type: 'time',
            format: 'HH:mm',
            trigger: 'click'
        });

        layui.form.on('submit(formsubmit)', function (obj) {
            var field = obj.field
            //哪个选项卡 用于刷新后保持
            var tabindex = 0;
            $('.layui-tab-title>li').each(function (i, v) {
                if ($(this).hasClass('layui-this')) {
                    tabindex = i;
                    console.log(i)
                    return false;
                }
            })
            field.tabindex = tabindex;
            field.inc_type = 'reg';
            var index = layer.load();
            $.post('{:url("handle")}', field, function (data) {
                layer.close(index);
                dialog(data.msg, data.status, data.url);
            })
        })

    })
    function choosezuobiao() {
        var address = $("input[name='info[address]']").val();
        var longitude = $("input[name='info[longitude]']").val();
        var latitude = $("input[name='info[latitude]']").val();
        var choosezblayer = layer.open({
            type: 2,
            shadeClose: true,
            area: ['800px', '560px'],
            'title': '选择坐标',
            content: "{:url('DesignerPage/choosezuobiao')}&address=" + (address ? address : "") + "&jd=" + (longitude ? longitude : "") + "&wd=" + (latitude ? latitude : ""),
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                var longitude = layero.find('iframe').contents().find('#mapjd').val();
                var latitude = layero.find('iframe').contents().find('#mapwd').val();
                $("input[name='info[longitude]']").val(longitude);
                $("input[name='info[latitude]']").val(latitude);
                layer.close(choosezblayer);
            }
        });
    }
</script>
</body>
</html>